package MathDataTest;
import java.util.Scanner;
//math类中函数取整
public class MathDemo2 {
    public static void main(String[] args) {
        System.out.println("请输入一个数字：");
        double num = new Scanner(System.in).nextDouble();
        System.out.println("大于或等于"+num+"的最小整数"+Math.ceil(num));
        System.out.println("小于或等于"+num+"的最大整数"+Math.floor(num));
        System.out.println("将"+num+"加上1/2后最接近的整数"+Math.round(num));
        System.out.println("最接近"+num+"的整数"+Math.rint(num));
    }
}
